<!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>fill-mode</title>

    <style type="text/css">
        .wrapper {
            position: relative;
            width: 80%;
            height: 120px;
            border: 1px solid blue;
            margin: 25px auto;
        }
        
        .ball {
            position: absolute;
            left: 0;
            top: 0;
            width: 100px;
            height: 100px;
            border-radius: 50%;
            border: 1px solid gray;
            box-shadow: 0 0 5px 4px #dedede inset;
            margin: 10px 0;
            animation-name: zhoujielun;
            animation-duration: 5s;
            animation-direction: normal;
            animation-iteration-count: 1;
            animation-delay: 3s;
            animation-play-state: running;
            animation-timing-function: linear;
        }
        
        @keyframes zhoujielun {
            from {
                left: 0;
                background: #9696ff;
            }
            to {
                left: 100%;
                background: #ffff00;
            }
        }
        
        .first {
            animation-fill-mode: none;
        }
        
        .second {
            animation-fill-mode: forwards;
        }
        
        .third {
            animation-fill-mode: backwards;
        }
        
        .fourth {
            animation-fill-mode: both;
        }
    </style>

</head>

<body>

    <div class="wrapper">
        <div class="ball first"></div>
    </div>

    <div class="wrapper">
        <div class="ball second"></div>
    </div>

    <div class="wrapper">
        <div class="ball third"></div>
    </div>

    <div class="wrapper">
        <div class="ball fourth"></div>
    </div>

</body>

</html>